import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'components/todo/todo_list.dart';
import 'views/todo/list_page.dart';
import 'views/todo/detail_page.dart';

class App extends StatelessWidget {
  const App({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        ChangeNotifierProvider(create: (_) => TodoList()),
      ],
      child: MaterialApp(
        title: 'flutter todo list',
        initialRoute: '/',
        routes: <String, WidgetBuilder>{
          '/': (context) => const ListPage(),
          '/list': (context) => const ListPage(),
          '/detail': (context) => const DetailPage(false),
          '/edit': (context) => const DetailPage(true),
        },
      ),
    );
  }
}
